<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title></title>
	</head>
	<body>
		<img src="images/1.jpg" id="pic" /><br />
		<input type="button" value="上一张" onclick="back()" />
		<input type="button" value="下一张" onclick="next()" />
		<script>
			var num=0;
			var a=pic.src.indexOf("images/");
			var num=parseInt(a)+7;
		    var b=pic.src.indexOf(".jpg");
		    var big=pic.src.substring(num,b);
			var back=function(){
				big=parseInt(big)-1;
				if(big!=0){
					pic.src="images/"+big+".jpg";
				}else{
					alert("已经是第一张了！！！");
				}
			};
			var next=function(){
				big=parseInt(big)+1;
				if(big<=5){
					pic.src="images/"+big+".jpg";
				}else{
					alert("已经是最后一张了！！！");
				}
			};
		</script>
	</body>
<hml>
